<script setup lang="ts">
import {ref, computed} from 'vue'

const pOfe = ref(0)
const pOfsingle = ref(0)
const nOftry = computed(() => {
  let n;
  n = Math.ceil(Math.log(1 - pOfe.value / 100) / Math.log(1 - pOfsingle.value / 100))
  return n
})
</script>

<template>
  <el-row>
    <el-col :span="6">
      <div class="grid-content ep-bg-purple">
        <el-text class="mx-1" size="large">期望概率：</el-text>
        <!--        <span class="demonstration">Default value</span>-->
      </div>
    </el-col>
    <el-col :span="18">
      <div class="grid-content ep-bg-purple-light">
        <div class="slider-demo-block">
          <el-slider
              v-model="pOfe"
              show-input
              :min="0.001"
              :max="99.999"
              :step="0.001"
          />
        </div>
      </div>
    </el-col>
  </el-row>

  <el-row>
    <el-col :span="6">
      <div class="grid-content ep-bg-purple">
        <el-text class="mx-1" size="large">单次事件概率：</el-text>
        <!--        <span class="demonstration">Default value</span>-->
      </div>
    </el-col>
    <el-col :span="18">
      <div class="grid-content ep-bg-purple-light">
        <div class="slider-demo-block">
          <el-slider
              v-model="pOfsingle"
              show-input
              :min="0.001"
              :max="99.999"
              :step="0.001"
          />
        </div>
      </div>
    </el-col>
  </el-row>
  <el-row style="margin-top: 5px">
    <el-col :span="24">
      <div class="grid-content ep-bg-purple">
        <el-statistic title="理论达到期望概率所需次数" :value="nOftry"/>
<!--        <el-input-->
<!--            v-model="nOftry"-->
<!--            :style="{width: '240px', textAlign: 'center'}"-->
<!--            size="large"-->
<!--        />-->
      </div>
    </el-col>
  </el-row>


</template>

<style scoped>
.centered-input .el-input__inner {
  text-align: center;
  vertical-align: middle;
  /* 设置宽度和高度 */
  //width: 200px;
  //height: 100px;
}

.el-statistic {
  --el-statistic-content-font-size: 40px;
  --el-statistic-title-font-size: 18px;
}
.el-row {
  margin-bottom: 0px;
  margin-left: 4px;
  margin-right: 4px;
}

.el-row:last-child {
  margin-bottom: 0;
}

.el-col {
  border-radius: 4px;
  margin-top: 2px;
  margin-bottom: 2px;
}

.ep-bg-purple {
  //background: #d3dce6;
}

.ep-bg-purple-light {
  //background: #afaf50;
}

.grid-content {
  display: flex;
  border-radius: 4px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
}

.slider-demo-block {
  display: flex;
  width: 100%;


}

.slider-demo-block .el-slider {
  margin-top: 0;
  margin-left: 12px;
}
</style>